﻿<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<%
	pageContext.setAttribute("APP_PATH",request.getContextPath());
%>
<head>
  <meta charset="utf-8" />
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="${APP_PATH}/static/ulogin/Css/index.min.css" />
<link rel="stylesheet" type="text/css" href="${APP_PATH}/static/ulogin/Css/bundle.0e5348ee.css" />
<style type="text/css">
/*<![CDATA[*/
body { height: 100%; }
/*]]>*/
</style>
<script type="text/javascript" src="${APP_PATH}/static/ulogin/Scripts/jquery.min.js"></script>
<script type="text/javascript" src="${APP_PATH}/static/ulogin/Scripts/index.min.js"></script>
<script type="text/javascript" src="${APP_PATH}/static/ulogin/Scripts/common.0e5348ee.js"></script>
<script type="text/javascript" src="${APP_PATH}/static/ulogin/Scripts/bundle.0e5348ee.js"></script>
<script type="text/javascript" src="${APP_PATH}/static/ulogin/Scripts/extra.0e5348ee.js"></script>
<script type="text/javascript" src="${APP_PATH}/static/ulogin/Scripts/ulogin.js"></script>
<script type="text/javascript">
/*<![CDATA[*/
$(document).ready(function() {
					play.soundBox.init();index.js.loadLeftIcon();index.js.loadLeftM();
                    $("input[name='userName']").focus();
				});
R.extra.pagesComponentTopinfo();

/*]]>*/
</script>
<title>AnimieSky登录</title>

  <!--[if lte IE 8]>
  <script src="${APP_PATH}/static/ulogin/Scripts/ccl_ie.js"></script>
  <script src="${APP_PATH}/static/ulogin/Scripts/excanvas.js"></script>
  <script src="${APP_PATH}/static/ulogin/Scripts/json2.js"></script>
  <script src="${APP_PATH}/static/ulogin/Scripts/jquery.xdomainrequest.min.js"></script>
  <script src="${APP_PATH}/static/ulogin/Scripts/selectivizr-min.js"></script>
  <style type="text/css">
    html {overflow-x:hidden;}
    .pie {behavior: url(${APP_PATH}/static/ulogin/js/PIE.htc);}
  </style>
  <![endif]-->
</head>
<body class="desktop" style="height: 800px;  background: url(${APP_PATH}/static/ulogin/Images/reg_bg.jpg); background-size:cover;">

	<div id="header">
    <div
        class="header-content" >
            <ul class="header-nav">
            <li class="homepage win"><a href="#" title="首页">首页</a></li>
            <li ><a href="#" title="资讯">资讯</a></li>
            <li><a href="#" title="视频站" style="padding-right: 40px;">视频站<span class="beta">beta</span></a></li>
            <li><a href="#" title="直播间" style="padding-right: 40px;">直播间<span class="beta">beta</span></a></li>
            <li ><a href="#" title="活动">活动</a></li>
            <li><a href="#" title="商城">商城</a></li>
        </ul>
        <ul class="header-opts">
                    <li class="header-input">
                    <form action="#" method="get"
                          onsubmit="return onHeaderSearchSubmit()">
                        <input id="header-search" autocomplete="off" name="s" type="text" value="" maxlength="50"
                               placeholder=搜索>
                        <button class="btn icon submit" type="submit" title="搜索"></button>
                    </form>
                    <div id="header-search-history" ></div>
                </li>
                                                                <li class="upload">
                <a target="_blank" href="#" title="投稿">投稿</a>
                <div class="upload-pop">
                    <ul>
                        <label>我要投稿</label>
                        <li><a target="_blank" href="#" title="声音投稿">声音投稿</a>
                        </li>
                        <li><a target="_blank" href="#" title="图片投稿">图片投稿</a>
                        </li>


                        <li><a target="_blank" href="#" title="申请加V">申请加V</a></li>

                    </ul>
                    <ul>
                        <label>玩转M站</label>
                        <li><a target="_blank" href="#" title="制作头像">制作头像</a>
                        </li>
                        <li><a target="_blank" href="#" title="如何插图">如何插图</a></li>
                        <li><a target="_blank" href="#" title="建立剧集">建立剧集</a></li>
                    </ul>

                </div>
            </li>
        </ul>
    </div>
</div>
	<div id="new_content">	
	<div id="login-page">
    
    <div class="content" id="login" style="position: relative; ">
  
        <div class="col-half" style="position: absolute; left: 50%; margin-left: -46%">
            <form class="form-group" method="post" onsubmit="return onLoginFormSubmit('login')">
                <span class="form-title">登录 AnimeSky</span>
                <div class="img-input" id="username">
                    <i></i>
                    <input type="text" name="userName" id ="uName" placeholder="手机号 /邮箱/用户名"/>
                    <div class="form-error-msg"></div>
                </div>
                <div class="img-input" id="password">
                    <i></i>
                    <input type="password" name="pwd" id="pwd" placeholder="密码"/>
                    <div class="form-error-msg"></div>
                </div>
                
               <div class="form-row verification-row" style="margin-top:1px;">
						<div class="img-input row-left"  >
							<input type="text"  id = "uCode" placeholder="验证码" >
							<div class="form-error-msg"></div>
						</div>
						<img  id="codeImg" style="float: right; width: 120px;height: 42px;
						border-radius:4px;"src="${APP_PATH}/verifiCode"/> 
						
					</div>
                
                <div class="form-row check-row">
                    <p class="form-checkbox">
                        <input id="check-row-before" type="checkbox" name="LoginForm[rememberMe]" value="1"/>
                        <label for="check-row-before">记住我</label>
                    </p>
                    <a class="btn-text red row-right" title="忘记密码？" href="#">忘记密码？</a>
                </div>
                <div class="form-row btn-row">
                    <a  id="ulogin" class="btn-half btn-white row-left" title="登录">登录</a>
                    <a class="btn-white btn-half row-right" title="注册" href="${APP_PATH}/mregisterLink">注册</a>
                </div>
                <span class="divider"></span>
                <div class="form-row thirdparty-row">
                    <span class="row-left">一键登录</span>
                    <a class="login-qq" title="QQ"></a>
                    <a class="login-weibo" title="微博"></a>
                    <a class="login-bilibili" title="bilibili"></a>
                </div>
            </form>
        </div>
    </div>
</div>
	</div>
	    <div class="clear"></div>

    <div id="main-footer">
        <p class="footer-row about-us">
            <a href="#" title="建议与反馈">建议与反馈</a>

            <a href="#" title="APP下载">APP下载</a>

            <a href="#" title="用户协议">用户协议</a>

            <a href="#" title="探索与发现">探索与发现</a>

            <a href="#" title="联系我们">联系我们</a>
            <a href="#" title="加入我们">加入我们</a>
            <a href="#" title="百度百科">百度百科</a>
        </p>
        <p class="footer-row links">
            友情链接：
            <a href="#" target="_blank" title="漫客网-中国第一原创动漫平台-知音漫客杂志官方网站！">斗破苍穹漫画</a>
            <a href="#" target="_blank" title="轻之文库">轻之文库</a>
            <a href="#" target="_blank" title="喵特">喵特</a>
            <a href="#" target="_blank" title="半次元">半次元</a>
            <a href="#" target="_blank" title="萌主页">萌主页</a>
            <a href="#" target="_blank" title="快看漫画">快看漫画</a>
            <a href="#" target="_blank" title="腾讯动漫频道">腾讯动漫频道</a>
            <a href="#" target="_blank" title="178动漫频道">178动漫频道</a>
            <a href="#" target="_blank" title="第一弹">第一弹</a>
            <a href="#" target="_blank" title="豆腐">豆腐</a>
        </p>
        <p class="footer-row">京ICP备: 14055174号-1 | <a target="_blank" href="#"><img src="${APP_PATH}/static/ulogin/Picture/beianicon.png" style="vertical-align: top;"> 京公网安备 1101050223546号</a></p>
        <p class="footer-row">大连东软信息学院 地址: 软件园路  A区 16座 电话: 0520-88888888</p>
    </div>

<script type="text/javascript">

//检验用户是否存在
$("#uName").change(function () {
	var uName = this.value;
	$.ajax({
		url:"http://localhost:8080/Anime-sky/checkUMP",
		type:"POST",
		data:"userName="+uName,
		success:function(result){
			if (result.code == 520) {
				show_validate_msg("#uName", "success", result.extend.regx);
			}else{
				show_validate_msg("#uName", "error", result.extend.regx);
				
			}
		}
			
	});
});

//显示校验结果的提示信息
function show_validate_msg(ele,status,msg){
	  //清除当前元素校验状态
	  if(status == "success"){
	  	$(ele).parent().removeClass("error");
	  	$(ele).next(".form-error-msg").text(msg);
	  }else if(status == "error"){
	  	$(ele).parent().addClass("error");
	  	$(ele).next(".form-error-msg").text(msg);
	  }
	  
}


$(document).ready(function() {
	uloginMain();
});
 function uloginMain(){
	// $(".form-error-msg").parent().removeClass("error");
	// $(".form-error-msg").text("");
	 
$("#ulogin").click(function() {
	//检验验证码是否正确
	 var vcode = $("#uCode").val();
		$.ajax({
			url:"http://localhost:8080/Anime-sky/checkVcode",
			type:"POST",
			data:"code="+vcode,
			success:function(result){
				if (result.code == 520) {
					show_validate_msg("#uCode", "success", result.extend.regx);
					//$("#ulogin").attr("vcode-ajax","success");
					//验证码正确的话开始登陆
					$.ajax({
						url:"http://localhost:8080/Anime-sky/userLogin",
						type:"GET",
						data:$(".col-half").eq(0).find("form").eq(0).serialize(),
						success:function(result){
						if(result.code == 520){
							//window.location.href=""
							//console.log(result);
							$(location).attr("href", "http://localhost:8080/Anime-sky/stimerLink");
						}else
							show_validate_msg("#pwd", "error", "密码错误！！！")
						
				    }
					});
					return false;
				}else{
					$("#codeImg").attr( "src","http://localhost:8080/Anime-sky/verifiCode?a="+new Date().getTime());
					show_validate_msg("#uCode", "error", result.extend.regx);
					//$("#ulogin").attr("vcode-ajax","error");
				}
			}
				
		});
	
});
 
$("#codeImg").click( function(){
    //切换验证码的原理是点击就重新将src设置一下，但是浏览器有缓存，所以我们需要在后面添加      一个参数来让浏览器不断发送请求，后面加的参数为时间，因为时间是不断变化的
	// this 不是Jquery 对象....
    $(this).attr( "src","http://localhost:8080/Anime-sky/verifiCode?a="+new Date().getTime());
});
 
 }
 
 





    /*<![CDATA[*/
R.extra.pagesMemberLogin();
/*]]>*/
</script>
</body>
</html>
